#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include"test2.h"
using namespace std;
void queueindit(Queue* pe)
{
	pe->a = (int*)malloc(sizeof(int) * x);
	if (pe->a == NULL)
	{
		perror("malloc::false");
		return;
	}
	pe->front = pe->rear = 0;
}
bool queuepush(Queue* pe, int x)
{
	assert(pe);
	if ((pe->rear) % x == pe->front)
	{
		return false;
	}
	pe->a[(pe->rear) % x] = x;
	pe->rear++;
	return true;
}
int queuepop(Queue* pe)
{
	assert(pe);
	if (isempty(pe))
	{
		return -1;
	}
	return pe->a[pe->front];
}
bool isempty(Queue* pe)
{
	if (pe->front == pe->rear)
	{
		return true;
	}
	else
	{
		return false;
	}
}
bool isfull(Queue* pe)
{
	assert(pe);
	if ((pe->rear) % x == pe->front)
	{
		return true;
	}
	else
	{
		return false;
	}
}


int front(Queue* pe)
{
	assert(pe);
	if (isempty(pe))
	{
		return -1;
	}
	else
	{
		if (pe->rear == x)
		{
			return pe->a[(pe->rear - 1)];
		}
		return pe->a[(pe->rear)];
	}
}